<template>
  <div class="wrapper">
    <!--    安卓有nfc-->
    <div
      class="androidList"
      v-if="
        isHaveNFCEntry.isHaveNfc == 1 && isHaveNFCEntry.isPhoneType == 'android'
      "
    >
      <div class="action-top">
        <div class="divList" @click="toYongJunKa()" v-if="yongjunShow">
          <img src="./yongjun.png" alt="" />
          <p>电子拥军卡</p>
        </div>
        <div class="divList" @click="toBagListTicket()">
          <img src="./kaquan3x.png" alt="" />
          <p>卡券</p>
        </div>

        <div class="divList" @click="pasteCardRecharge()">
          <img src="./tieka01.png" alt="" />
          <p>贴卡充值</p>
        </div>
        <div class="divList" @click="electronicInvoice()">
          <img src="./incvoiceicon.png" alt="" />
          <p>电子发票</p>
        </div>
        <div
          class="divList"
          @click="toAndroidTheme()"
          v-if="isHshowAndroidTheme"
        >
          <img src="./theme03.gif" alt="" />
          <p>卡面主题</p>
        </div>
        <div class="divList" @click="jfStore(jfShopUrl)">
          <img src="./jifenShop.png" alt="" />
          <p>积分商城</p>
        </div>
        <div class="divList" @click="jfStore(cardMarketIndex)">
          <img src="./yxsc.gif" alt="" />
          <p>优选商城</p>
        </div>
        <div class="divList" @click="jfStore(cardMarketQYIndex)">
          <img src="./qiyeshangcheng@3x.png" alt="" />
          <p>企业商城</p>
        </div>
        <div class="divList" @click="handleClick()">
          <img src="./jiaoyijilu@2x.png" alt="" />
          <p>我的行程</p>
        </div>

        <!--        <div class="divList" @click="toSoldierCard()">-->
        <!--          <img src="./YJK@2x.png" alt="">-->
        <!--          <p>电子拥军卡</p>-->
        <!--        </div>-->
        <!--        <div class="divList" @click="businessAcc()">-->
        <!--          <img src="./qiyezhanghu.png" alt="">-->
        <!--          <p>企业员工卡</p>-->
        <!--        </div>-->
        <div class="divList" @click="shopStore()">
          <img src="./qijiandian01.png" alt="" />
          <p>旗舰店</p>
        </div>
        <div class="divList" @click="toOnLine()">
          <img src="./zaixiankefu@2x.png" alt="" />
          <p>在线客服</p>
        </div>
        <div class="divList" @click="cardTimeUp()">
          <img src="./takyq.png" alt="" />
          <p>卡片延期</p>
        </div>
        <div class="divList" @click="toChangeCode()">
          <img src="./changeCode@3x.png" alt="" />
          <p>充值码充值</p>
        </div>
<!--        <div class="divList" @click="suburbCard()">-->
<!--          <img src="./shijiaotielu.png" alt="" />-->
<!--          <p>市郊铁路卡</p>-->
<!--        </div>-->
        <div class="divList" @click="toStudentCardSearch()">
          <img src="./student@3x.png" alt="" />
          <p>学生卡查询</p>
        </div>
        <div class="divList" @click="toQYCard()">
          <img src="./qy@3x.png" alt="" />
          <p>企业员工卡</p>
        </div>
        <div class="divList" @click="topecialSCard()" v-if="mingshenShow">
          <img src="./tezhongkafuwu.png" alt="" />
          <p>特种卡服务</p>
        </div>
        <div class="divList" @click="toParkRealName()" v-if="mingshenShow">
          <img src="./nianpiaoshiming.png" alt="" />
          <p>年票实名</p>
        </div>
        <div class="divList" @click="toParkList()" v-if="mingshenShow">
          <img src="./nianpiaoyuyue.png" alt="" />
          <p>公园年票预约</p>
        </div>
        <div class="divList" @click="toDivestment()" v-if="isShowDiveIcon">
          <img src="./huaika@3x.png" alt="" />
          <p>坏卡退资</p>
        </div>
        <div class="divList" @click="toWearDevice()">
          <img src="./wearDevice.png" alt="" />
          <p>穿戴一卡通</p>
        </div>
        <div class="divList" @click="toMinSheng()" v-if="mingshenShow">
          <img src="./minshengka.png" alt="" />
          <p>民生卡服务</p>
        </div>
      </div>
    </div>
    <!--    安卓无nfc-->
    <div
      class="androidList"
      v-if="
        isHaveNFCEntry.isHaveNfc != 1 && isHaveNFCEntry.isPhoneType == 'android'
      "
    >
      <div class="action-top">
        <div class="divList" @click="toBagListTicket()">
          <img src="./kaquan3x.png" alt="" />
          <p>卡券</p>
        </div>
        <div class="divList" @click="electronicInvoice()">
          <img src="./incvoiceicon.png" alt="" />
          <p>电子发票</p>
        </div>
        <div class="divList" @click="toOnLine()">
          <img src="./zaixiankefu@2x.png" alt="" />
          <p>在线客服</p>
        </div>
        <div class="divList" @click="handleClick()">
          <img src="./jiaoyijilu@2x.png" alt="" />
          <p>我的行程</p>
        </div>
        <!--        <div class="divList" @click="suburbCard()">-->
        <!--          <img src="./shijiaotielu.png" alt="">-->
        <!--          <p>市郊铁路卡</p>-->
        <!--        </div>-->
        <div class="divList" @click="shopStore()">
          <img src="./qijiandian01.png" alt="" />
          <p>旗舰店</p>
        </div>
        <div class="divList" @click="jfStore(jfShopUrl)">
          <img src="./jifenShop.png" alt="" />
          <p>积分商城</p>
        </div>
        <div class="divList" @click="jfStore(cardMarketIndex)">
          <img src="./yxsc.gif" alt="" />
          <p>优选商城</p>
        </div>
        <div class="divList" @click="jfStore(cardMarketQYIndex)">
          <img src="./qiyeshangcheng@3x.png" alt="" />
          <p>企业商城</p>
        </div>
<!--        <div class="divList" @click="suburbCard()">-->
<!--          <img src="./shijiaotielu.png" alt="" />-->
<!--          <p>市郊铁路卡</p>-->
<!--        </div>-->
        <div class="divList" @click="toStudentCardSearch()">
          <img src="./student@3x.png" alt="" />
          <p>学生卡查询</p>
        </div>
        <div class="divList" @click="toQYCard()">
          <img src="./qy@3x.png" alt="" />
          <p>企业员工卡</p>
        </div>
        <div class="divList" @click="toParkRealName()" v-if="mingshenShow">
          <img src="./nianpiaoshiming.png" alt="" />
          <p>公园年票</p>
        </div>
        <div class="divList" @click="toParkList()" v-if="mingshenShow">
          <img src="./nianpiaoyuyue.png" alt="" />
          <p>公园年票预约</p>
        </div>
        <div class="divList" @click="toMinSheng()" v-if="mingshenShow">
          <img src="./minshengka.png" alt="" />
          <p>民生卡服务</p>
        </div>
        <div class="divList" @click="toWearDevice()">
          <img src="./wearDevice.png" alt="" />
          <p>穿戴一卡通</p>
        </div>
      </div>
    </div>
<!-- 苹果 -->
    <div
      class="androidList"
      v-if="
        isHaveNFCEntry.isHaveNfc == 1 && isHaveNFCEntry.isPhoneType != 'android'
      "
    >
      <div class="action-top">
        <div class="divList" @click="toBagListTicket()">
          <img src="./kaquan3x.png" alt="" />
          <p>卡券</p>
        </div>
        <div
          class="divList"
          @click="pasteCardRecharge()"
        >
          <img src="./tieka01.png" alt="" />
          <p>贴卡充值</p>
        </div>
        <div class="divList" @click="handleClick()">
          <img src="./jiaoyijilu@2x.png" alt="" />
          <p>我的行程</p>
        </div>
        <div class="divList" @click="toOnLine()">
          <img src="./zaixiankefu@2x.png" alt="" />
          <p>在线客服</p>
        </div>
        <div class="divList" @click="toAndroidTheme()">
          <img src="./theme03.gif" alt="" />
          <p>卡面主题</p>
        </div>
        <div class="divList" @click="shopStore()">
          <img src="./qijiandian01.png" alt="" />
          <p>旗舰店</p>
        </div>
        <!--        <div class="divList" @click="suburbCard()">-->
        <!--          <img src="./shijiaotielu.png" alt="">-->
        <!--          <p>市郊铁路卡</p>-->
        <!--        </div>-->
        <div class="divList" @click="jfStore(jfShopUrl)">
          <img src="./jifenShop.png" alt="" />
          <p>积分商城</p>
        </div>
        <div
          class="divList"
          @click="jfStore(cardMarketIndex)"
          v-if="couponShopShow"
        >
          <img src="./yxsc.gif" alt="" />
          <p>优选商城</p>
        </div>
        <div class="divList" @click="jfStore(cardMarketQYIndex)">
          <img src="./qiyeshangcheng@3x.png" alt="" />
          <p>企业商城</p>
        </div>
        <!--        <div class="divList" @click="businessAcc()">-->
        <!--          <img src="./qiyezhanghu.png" alt="">-->
        <!--          <p>企业员工卡</p>-->
        <!--        </div>-->
        <div class="divList" @click="electronicInvoice()">
          <img src="./incvoiceicon.png" alt="" />
          <p>电子发票</p>
        </div>
        <div class="divList" @click="toChangeCode()">
          <img src="./changeCode@3x.png" alt="" />
          <p>充值码充值</p>
        </div>
<!--        <div class="divList" @click="suburbCard()">-->
<!--          <img src="./shijiaotielu.png" alt="" />-->
<!--          <p>市郊铁路卡</p>-->
<!--        </div>-->
        <div class="divList" @click="toStudentCardSearch()">
          <img src="./student@3x.png" alt="" />
          <p>学生卡查询</p>
        </div>
        <!-- ios 适配卡片延期 -->
        <div class="divList" @click="cardTimeUp()">
          <img src="./takyq.png" alt="" />
          <p>卡片延期</p>
        </div>
        <div class="divList" @click="toQYCard()">
          <img src="./qy@3x.png" alt="" />
          <p>企业员工卡</p>
        </div>
        <div class="divList" @click="toParkRealName()" v-if="mingshenShow">
          <img src="./nianpiaoshiming.png" alt="" />
          <p>公园年票</p>
        </div>
        <div class="divList" @click="toParkList()" v-if="mingshenShow">
          <img src="./nianpiaoyuyue.png" alt="" />
          <p>公园年票预约</p>
        </div>
        <div class="divList" @click="toMinSheng()" v-if="mingshenShow">
          <img src="./minshengka.png" alt="" />
          <p>民生卡服务</p>
        </div>
      </div>
    </div>

    <div v-if="isShowAdver">
      <div class="rechargeAdver">
        <svg
          v-if="Object.keys(chargeAdver).length > 0"
          @click="closeAdver"
          class="closeiconX"
          width="16px"
          height="16px"
          viewBox="0 0 12 12"
          version="1.1"
          xmlns="http://www.w3.org/2000/svg"
        >
          <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
            <g
              id="Artboard-9"
              transform="translate(-73.000000, -15.000000)"
              fill="#FFFFFF"
              fill-rule="nonzero"
            >
              <g id="Group" transform="translate(73.000000, 15.000000)">
                <path
                  d="M5.29289322,6 L0.646446609,1.35355339 L1.35355339,0.646446609 L6,5.29289322 L10.6464466,0.646446609 L11.3535534,1.35355339 L6.70710678,6 L11.3535534,10.6464466 L10.6464466,11.3535534 L6,6.70710678 L1.35355339,11.3535534 L0.646446609,10.6464466 L5.29289322,6 Z"
                  id="Combined-Shape"
                ></path>
              </g>
            </g>
          </g>
        </svg>
        <div
          v-if="chargeAdver.supportFormat == 2"
          @click="toAdverHref(chargeAdver, adverClick)"
          class="rechargeAdver-text"
        >
          {{ chargeAdver.adresources }}
        </div>
        <img
          v-if="
            chargeAdver.supportFormat == 1 || chargeAdver.supportFormat == 4
          "
          @click="toAdverHref(chargeAdver, adverClick)"
          class="rechargeAdverImg"
          :src="chargeAdver.adresources"
          alt=""
        />
        <iframe
          v-if="chargeAdver.supportFormat == 6"
          :src="chargeAdver.adresources"
          @click="toAdverHref(chargeAdver, adverClick)"
          id="chargeiframe"
        ></iframe>

        <!--      视频 上面ios下面安卓-->
        <div
          v-if="isiOS && chargeAdver.supportFormat == 3"
          @click="toAdverHref(chargeAdver, adverClick)"
          class="cardDetailImgWrap02"
        >
          <video
            id="videoClass"
            controls="controls"
            loop="loop"
            preload="auto"
            type="video/mp4"
            muted="false"
            autoplay
            webkit-playsinline
            playsinline
            x5-playsinline
            x-webkit-airplay="allow"
          >
            <source :src="chargeAdver.adresources" />
          </video>
        </div>
        <div
          v-if="!isiOS && chargeAdver.supportFormat == 3"
          @click="toAdverHref(chargeAdver, adverClick)"
          class="cardDetailImgWrap02"
        >
          <video
            :src="chargeAdver.adresources"
            id="myVideo"
            loop="loop"
            autoplay="autoplay"
            muted="false"
            playsinline
            x5-playsinline
            x-webkit-airplay="allow"
          >
            <source :src="chargeAdver.adresources" />
          </video>
        </div>
      </div>
    </div>
    <!-- <div class="divList" @click="shubi()" >
          <img src="./yongjun.png" alt="" />
          <p>数币卡券领</p>
        </div> -->
  </div>
</template>

<script>
import { detaMixin } from "../../util/mixins";

import { Base64 } from "js-base64";
import md5 from "js-md5";
import { Store } from "../../util/localStorageJS";

let u = navigator.userAgent;
let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
let swit = false; //变更开关
if (swit) {
  // 测试接口
  var cardMarketQYIndex =
    "https://test.all-pay.cn/smallshopcard/#/cardMarketQYIndex?"; // 企业商城
  var cardMarketIndex =
    "https://test.all-pay.cn/smallshopcard/#/cardMarketIndex?"; // 卡券商城
} else {
  // 生产接口
  var cardMarketQYIndex =
    "https://w.all-pay.cn/smallshopcard/#/cardMarketQYIndex?"; // 企业商城
  var cardMarketIndex = "https://w.all-pay.cn/smallshopcard/#/cardMarketIndex?"; // 卡券商城
}

export default {
  mixins: [detaMixin],

  data() {
    return {
      isSHowIOSreadCard: false, // 是否展示苹果贴卡充值

      adverPathUrl: "",
      tokenPassword: "",
      authorizations: "",
      thirdPayOrderSign: "",
      productUrl: "",
      cardMarketQYIndex: "",
      cardMarketIndex: "",
      jfShopUrl: "",

      isShowAdver: false, // 默认不展示广告容器，根据客户端返回结果控制是否展示
      isiOS: isiOS,
      chargeAdver: {}, // 广告资源
      adverClick: {}, // 广告点击跳转传递的参数
      isHshowAndroidTheme: false, // 安卓主题入口是否展示
      isHaveNFCEntry: {},
      lastTime: 0, //默认上一次点击时间为0
      isShowDiveIcon: false, // 是否展示怀卡退资接口
      yongjunShow: false,
      mingshenShow: false,
      couponShopShow: true,
    };
  },
  created() {
    if (isiOS) {
      BmacJSBridge.call("isHiddenWechat", (data) => {
        console.log("第三方", data);
        if (data.wechat == "1") {
          console.log("00000");
          this.couponShopShow = false;
        } else {
          console.log("11111");
          this.couponShopShow = true;
        }
      });
    }
  },
  mounted() {
    this._getUserInfoData(); // 获取用户信息，没有登录并跳转登录
    setTimeout(() => {
      BmacJSBridge.call("obtainClientBaseUrl", {}, (data) => {
        console.log(data, "----------------------");
        // 通过域名来判断生产环境还是测试环境
        // if (data.pay3BaseUrl == "https://appprod.bmac.com.cn") {
        //   this.mingshenShow = false;
        // } else {
        //   this.mingshenShow = true;
        // }
        if(data.environment == 'test'){
          this.mingshenShow = true;
        }else {
          this.mingshenShow = false;
        }
      });
      BmacJSBridge.call("isSupportNFCCard", (data) => {
        if (data.haveNFC === 1) {
          this.isSHowIOSreadCard = true;
        }
      });
      // 控制拥军卡入口 小米 华为 提供 坏卡退资
      BmacJSBridge.call("getBasicInfo", (data) => {
        if (
          data.deviceData.manufacturer == "Xiaomi" ||
          data.deviceData.manufacturer == "HUAWEI" || data.deviceData.manufacturer == "vivo" || data.deviceData.manufacturer == "OPPO" || data.deviceData.manufacturer == "HONOR"
        ) {
          // if(data.deviceData.manufacturer == "OPPO"){
          //   this.yongjunShow = false;
          // }else {
          //   this.yongjunShow = true;
          // }
          this.yongjunShow = true;
          this.isShowDiveIcon = true;
        }
        console.log(data, "----------");
      });
      BmacJSBridge.call("obtainClientBaseUrl", (data) => {
        //获取app用到的接口
        console.log("app接口地址", data);
        BmacJSBridge.call("shopClientBaseUrl", (jfdata) => {
          console.log("app积分接口地址shopBaseUrl", jfdata);
          this.cardMarketQYIndex =
            data.isProd == 0
              ? "https://uat-w.all-pay.cn/smallshopcard/#/cardMarketQYIndex?"
              : "https://w.all-pay.cn/smallshopcard/#/cardMarketQYIndex?";
          this.cardMarketIndex =
            data.isProd == 0
              ? "https://uat-w.all-pay.cn/smallshopcard/#/cardMarketIndex?"
              : "https://w.all-pay.cn/smallshopcard/#/cardMarketIndex?";
          this.adverPathUrl = `${data.adBaseUrl}/`;
          this.tokenPassword = `${data.adTokenPassword}`;
          this.authorizations = `${data.Authorization}`;
          this.thirdPayOrderSign = `${data.pay3BaseUrl}/wolf-thirdpre/third/pre/thirdPayOrderSign`;
          this.productUrl = `${data.pay3BaseUrl}/`;
          this.jfShopUrl = `${jfdata.shopBaseUrl}`;
          BmacJSBridge.call("setTitle", {
            title: "更多",
          });
          BmacJSBridge.call("isShowThemeEntry", (data) => {
            console.error('isShowThemeEntry',data)
            if (data.isShow == "01") {
              this.isHshowAndroidTheme = true; // 显示安卓主题商城入口
            }
          });
          BmacJSBridge.call("isPhoneHaveNFC", (data) => {
            let isHaveNfc = data.parameter.haveNFC;
            let isPhoneType = data.parameter.deviceType; // android,iphone判断手机类型，暂时用不到，保留字段
            this.isHaveNFCEntry = {
              isHaveNfc: isHaveNfc,
              isPhoneType: isPhoneType,
            };
          });

          this.adverHttpRequestMore().then((resAdver) => {
            console.log("更多页广告位", resAdver);
            this.chargeAdver = resAdver.resAdver;
            this.adverClick = resAdver.clickData;
          });



          BmacJSBridge.call(
            "advertisingMoreState",
            { type: "SE0000009" },
            (data) => {
              // 获取客户端是否 是杀死进程进来，从来判断广告是否显示
              console.log("首页浮标是否展示", data.advertisingMore);
              this.isShowAdver = data.advertisingMore;
            }
          );
        });
      });
    }, 300);
  },
  methods: {
    // shubi(){
    //   window.location.href = 'https://h5prod.bmac.com.cn/marketingcoupon/index.html#/?type=0'
    // },
    adverHttpRequestMore() {
      // 获取广告位资源，并且返回一个promise对象
      return new Promise((resolve, reject) => {
        this.$ajax({
          method: "post",
          timeout: 20000,
          url: this.adverPathUrl + "auth",
          headers: {
            "Content-Type": "application/x-www-form-urlencoded; charset=utf-8",
          },
          data: {
            userName: "admin",
            password: this.tokenPassword,
          },
          transformRequest: [
            function (data) {
              let ret = "";
              for (let it in data) {
                ret +=
                  encodeURIComponent(it) +
                  "=" +
                  encodeURIComponent(data[it]) +
                  "&";
              }
              return ret;
            },
          ],
        }).then((res) => {
          BmacJSBridge.call("getBasicInfo", (data) => {
            let datas = data.deviceData || data;
            res.data.imei = datas.imei;

            // resolve(res.data) // 返回token相关
            let reqAdverList = {
              randomKeyStr: res.data.randomKey,
              tokenStr: res.data.token,
              imeiStr: res.data.imei,
              nameStr: "SE0000009",
            };
            console.log("reqAdverList", reqAdverList);
            let adverDate = {
              adpositionAlias: reqAdverList.nameStr,
              imei: reqAdverList.imeiStr,
            };
            let base = Base64.encode(JSON.stringify(adverDate));
            let md5Base = md5(base + reqAdverList.randomKeyStr);
            let getAdveObj = JSON.stringify({
              object: base,
              sign: md5Base,
            });
            this.$ajax({
              method: "post",
              timeout: 20000,
              url: this.adverPathUrl + "advertising/getResources", // 获取轮播图接口
              data: getAdveObj,
              headers: {
                "content-type": "application/json",
                Authorization: "Bearer " + reqAdverList.tokenStr,
              },
            }).then((adverRes) => {
              let resAdver = JSON.parse(Base64.decode(adverRes.data.object));
              console.log(resAdver);
              let adverData = {
                resAdver: resAdver,
                clickData: {
                  towebUrl: this.thirdPayOrderSign,
                  authorizations: this.authorizations,
                  adverPathUrl: this.adverPathUrl,
                  token: reqAdverList.tokenStr,
                  imei: reqAdverList.imeiStr,
                  randomKeyStr: reqAdverList.randomKeyStr,
                },
              };
              resolve(adverData);
            });
          });
        });
      });
    },
    toAdverHref(a, b) {
      // a广告资源，b商城跳转资源
      let clickData = {
        adresourcesId: a.adresourcesId,
        adpositionId: a.adpositionId,
        adpositionName: a.adpositionName,
        imei: b.imei,
        type: "1",
      };
      //
      let base = Base64.encode(JSON.stringify(clickData));
      let md5Base = md5(base + b.randomKeyStr);
      let getAdveObj = JSON.stringify({
        object: base,
        sign: md5Base,
      });
      this.$ajax({
        // 点击量请求
        method: "post",
        url: b.adverPathUrl + "advertising/clickrate",
        data: getAdveObj,
        headers: {
          "content-type": "application/json",
          Authorization: "Bearer " + b.token,
        },
      });
      if (a.type == 1) {
        //商城1
        this.chargetoShoppingUrlAdver(a, b);
      } else if (a.type == 2) {
        //不跳转
        return;
      } else if (a.type == 5) {
        //微信小程序
        BmacJSBridge.call("toWXLaunchMiniProgram", {
          userName: a.adresourcesName,
          reqPath: a.adresourcesUrl,
        });
      } else if (a.type == 6) {
        //支付宝小程序
        BmacJSBridge.call(
          "startApp",
          {
            appId: a.adresourcesUrl,
            msg: "首页跳转主题",
            type:"3"
          },
          (result) => {}
        );
      } else if (a.type == 7) {
        //跳转离线包
        BmacJSBridge.call(
          "startApp",
          {
            appId: a.adresourcesUrl,
            passData: {
              info: JSON.stringify(a),
            },
            type:"1"
          },
          (result) => {}
        );
      } else {
        // 其他统一跳转Url
        // alert(a.adresourcesUrl)
        BmacJSBridge.call("startApp", {
          url: a.adresourcesUrl, // 要打开页面的 URL
          // 打开页面的配置参数
          readTitle: true, //自动读取 title
          showOptionMenu: false, // 隐藏右边菜单
          // 用于给新开的页面传递参数，可选
          // 在新开的页面使用 BmacJSBridge.startupParams 可以获取到 passData
          passData: {
            key1: "key1Value",
            key2: "key2Value",
          },
          type:"2"
        });
      }
    },
    chargetoShoppingUrlAdver(a, b) {
      this._getUserInfoData().then((userInfo) => {
        const toNeteaseUrl = {
          channelCode: a.channelCode,
          extendParam: userInfo.userLoginId,
          extUserId: userInfo.customerId, // 用户唯一标识
          position: "home",
          moduleCode:
            a.channelCode == "bjyikatong" || "bjykt_yanxuan"
              ? "you163shop"
              : "",
        };
        console.log("商城", b);
        BmacJSBridge.call(
          "encryptDataWithRSA3",
          toNeteaseUrl,
          (resultEncrypt) => {
            var datas = resultEncrypt.encryptedData;
            this.$ajax({
              method: "post",
              url: b.towebUrl,
              data: datas,
              headers: {
                "Content-Type": "application/json",
                Authorization: b.authorizations,
              },
            }).then((resultSign) => {
              BmacJSBridge.call(
                "decryptDataWithRSA3",
                { decryptParam: resultSign.data },
                (databut) => {
                  const request = databut.encryptedData;
                  console.warn("商城签名", request);

                  let toNeteaseUrllink = `${a.shopUrl}?channelCode=${
                    toNeteaseUrl.channelCode
                  }&extUserId=${userInfo.customerId}&extendParam=${
                    userInfo.userLoginId
                  }&position=${toNeteaseUrl.position}&timestamps=${
                    request.timestamps
                  }&sign=${request.sign.toUpperCase()}&version=4`;
                  console.warn(toNeteaseUrllink);
                  BmacJSBridge.call("startApp", {
                    url: toNeteaseUrllink, // 要打开页面的 URL
                    // 打开页面的配置参数
                    readTitle: true, //自动读取 title
                    showOptionMenu: false, // 隐藏右边菜单
                    // 用于给新开的页面传递参数，可选
                    // 在新开的页面使用 BmacJSBridge.startupParams 可以获取到 passData
                    passData: {
                      key1: "key1Value",
                      key2: "key2Value",
                    },
                    type:'2'
                  });
                }
              );
            });
          }
        );
      });
    },
    closeAdver() {
      BmacJSBridge.call("advertisingMoreClose", {
        type: "SE0000009",
        title: "关闭更多页广告",
      });
      this.isShowAdver = false;
    },
  },
  components: {},
};
</script>

<style>
.wrapper {
  width: 100%;
  height: 100%;
}

.action-top {
  width: 100%;
  overflow: hidden;
}

.divList {
  float: left;
  width: 20%;
  height: 1.2rem;
  overflow: hidden;
  text-align: center;
  font-size: 12px;
  color: #333;
}

.divList img {
  display: block;
  margin: 12px auto 5px;
  width: 0.48rem;
  height: 0.48rem;
}

.rechargeAdver {
  position: relative;
  font-size: 12px;
  line-height: 20px;
  margin: 20px 16px;
  height: 83px;
  border-radius: 4px;
  overflow: hidden;
}

.closeiconX {
  position: absolute;
  top: 0;
  right: 0;
  background-color: #000;
}

.rechargeAdver-text {
  overflow-y: auto;
  height: 83px;
}

.rechargeAdverImg {
  display: block;
  width: 100%;
  height: 83px;
}

#chargeiframe {
  width: 100%;
  height: 83px;
}
</style>
